//
//  UIBarButtonItem+Extension.swift
//  iOSweibo
//
//  Created by lzm on 16/5/16.
//  Copyright © 2016年 lzm. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    convenience init(image: String, target: AnyObject?, action: Selector) {
        let button = UIButton()
        button.setImage(UIImage(named:image), forState: UIControlState.Normal)
        button.setImage(UIImage(named: image + "_highlighted"), forState: UIControlState.Highlighted)
        button.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        
        button.sizeToFit()
        self.init(customView: button)
    }
}
